1. Field of the Invention
The present invention relates to a switching device for selecting RS-232 serial port and USB serial port. More particularly, the present invention relates to using a photo-coupler to automatically select one receiving data pin (RXD line) of both RS-232 serial port and USB serial port so that a computer and peripherals thereof are able to communicate with the RS-232 serial port or the USB serial port. In operation, when one of the RS-232 serial port and the USB serial port is selected, a transmitting data pin (TXD line) of the other is still able to transmit data from a microprocessor to another computer.
2. Description of the Related Art
Conventionally, a computer usually possesses a single RS-232 (Recommended standard 232) communication port or USB (Universal Serial Bus) communication port and hardly possesses these two ports at the same time. This results in inconvenience in data communication.
The conventional communication device using the RS-232 communication port, as shown in FIG. 1, includes a single USART (Universal Synchronous Asynchronous Receiver Transmitter) microprocessor 11, a RS-232/USART converter element 12 and a RS-232 serial port 13. The communication device 1 adopts serial communication and has a signal transmission line for transmitting and receiving data. The microprocessor 11 contains a single USART set electrically connecting to the RS-232/USART converter element 12 for converting voltage signals. Further, the RS-232/USART converter element 12 electrically connects to the RS-232 serial port 13 that communicates with a first computer 2 via a transmission line. The first computer 2 is able to transmit and receive data bit by bit through a transmission line.
In 1969 the Electrical Industries Association adopted the RS-232 communication protocol which has two voltage signal ranges: one ranging between −3V and −25V denoting logical signal “1” and the other ranging between 3V and 25V denoting logical signal “0”. A computer peripheral, such as UPS, contains a microprocessor control unit (MCU) using a voltage 5V or 3.3V. Therefore, the conventional communication device 1 must include the RS-232/USART converter element 12 for converting transmission signals of the microprocessor 11 and the RS-232 serial port 13.
Referring to FIG. 2, the other conventional communication device 10 includes a single USART microprocessor 11, a USB/USART converter element 14 and a USB serial port 15. The microprocessor 11 contains a single USART set electrically connecting to the USB/USART converter element 14 for converting voltage signals. Further, the USB/USART converter element 14 electrically connects to the USB serial port 15 that communicates with a second computer 20 via a transmission line. The second computer 20 is able to transmit and receive data bit by bit through a transmission line.
The USB communication protocol was developed by Intel, Compaq, DEC, IBM, Microsoft, NEC, and Northern Telecom. However, USB protocol has replaced RS-232 protocol and become a single, general-purpose port for computer peripherals. It is apparent that the USB serial port is a universal protocol port for computer peripherals communicating with a host computer.
Recently, communication interfaces of both RS-232 and USB are widely applied to a computer system and peripherals. The peripheries of the computer must offer these two interfaces at the same time. So far, the RS-232 serial port of a computer peripheral is only available for an RS-232 protocol interface of the computer system. To exchange the RS-232 protocol interface of the computer system with a USB interface, it is necessary to add an RS-232/USB converter. Alternatively, the USB serial port of a computer peripheral is only available for a USB interface of the computer system. To exchange the USB interface of the computer system with an RS-232 protocol interface, it is necessary to add a USB/RS-232 converter. From the viewpoint of manufacture, it is inconvenient for production management to produce the different peripheries with only one of communication interfaces for RS-232 and USB.
To solve this problem, a computer peripheral adopting a communication device 3 having both of a RS-232 serial port and a USB serial port are shown in FIGS. 3 and 4.
FIG. 3 depicts a schematic view of dual communication interfaces of a communication device for RS-232 and USB. The communication device 3 includes a dual USARTs microprocessor 31, a RS-232/USART converter element 32, a RS-232 serial port 33, a USB/USART converter element 34 and a USB serial port 35. One USART interface of the double USART microprocessor 31 electrically connects to the RS-232/USART converter element 32. And, the RS-232/USART converter element 32 electrically connects to the RS-232 serial port 33 for providing a RS-232 protocol interface. Subsequently, the RS-232 serial port 33 communicates with a first computer 2. The other USART interface of the dual USARTs microprocessor 31 electrically connects to the USB/USART converter element 34. And, the USB/USART converter element 34 electrically connects to the USB serial port 35 for providing a USB interface. Subsequently, the USB serial port 35 communicates with a second computer 20.
FIG. 4 depicts a schematic view of other dual communication interfaces of a communication device for RS-232 and USB. The communication device 4 includes a first single USART microprocessor 41, a second single USART microprocessor 41′, a RS-232/USART converter element 42, a RS-232 serial port 43, a USB/USART converter element 44 and a USB serial port 45. A USART interface of the first USART microprocessor 41 electrically connects to the RS-232/USART converter element 42. And, the RS-232/USART converter element 42 electrically connects to the RS-232 serial port 43 for providing a RS-232 protocol interface. Subsequently, the RS-232 serial port 43 communicates with a first computer 2. A USART interface of the second USART microprocessor 41′ electrically connects to the USB/USART converter element 44. And, the USB/USART converter element 44 electrically connects to the USB serial port 45 for providing a USB interface. Subsequently, the USB serial port 45 communicates with a second computer 20.
However, the communication device including RS-232 and USB may increase manufacture cost even though it has an advantage of providing dual communication functions for RS-232 and USB simultaneously.
The present invention intends to provide a switching device for RS-232 serial port and USB serial port using a photo-coupler device to automatically select one receiving data pin (RXDA and RXDB lines) of the RS-232 serial port or the USB serial port for communicating data. Firstly, a microprocessor with only one USART can be used to perform automatically selecting one receiving data pin (RXD line) of both RS-232 serial port and USB serial port as a main COM port for communicating data from the microprocessor to a first computer. Secondly, the other unselected one of a transmitting data pin (TXD line) of the RS-232 serial port and the USB serial port that is regarded as a secondary COM port still also transmits data from the microprocessor to a second computer. Thereby, the switching device for RS-232 serial port and USB serial port employs the photo-coupler device to automatically select one of the RS-232 serial port or the USB serial port in such a way to mitigate and overcome the above problem.